/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.front.web.refund.wx;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.config.entity.weixin.ConfigWechat;
import com.thinkgem.jeesite.modules.config.service.weixin.ConfigWechatService;

/**
 * 支付Controller（FRONT）
 * 
 * @author Egan
 * @version 2016-12-15
 */
@Controller
@RequestMapping(value = "${frontPath}/refund/wx")
public class WXRefundController extends BaseController {
	private static Log log = LogFactory.getLog(WXRefundController.class);
	
	@Autowired WXRefundService wxRefundService;
	
	@Autowired
    ConfigWechatService configWechatService;
	
	@RequestMapping(value = "forRefund")
	@ResponseBody
	public Object forRefund(HttpServletRequest req,String orderId,String txnAmt, HttpServletResponse resp, Model model) {
		try {
			ConfigWechat configWechat = configWechatService.getConfigWechat();
			Map<String,String> resultMap = wxRefundService.forRefund(txnAmt, orderId,configWechat);
			return resultMap;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
}